import React from 'react';
import ReactDOM from 'react-dom';

import {createHashHistory} from 'History';

import {Router, Route, useRouterHistory} from 'react-router';

import {syncHistoryWithStore, RouterStore} from 'mobx-react-router';

import {Provider} from 'mobx-react';

import {WeaDebugRouteMenu} from 'ecCom';

WeaDebugRouteMenu.defaultProps.showRouteLev = 3;

import Module from './index';
import TestS from './stores/index'

const routing = new RouterStore();

const allStore = {
    routing,
    ...Module.store,
    ...TestS,
};

const browserHistory = useRouterHistory(createHashHistory)({
    queryKey: '_key',
    basename: '/',
});

const history = syncHistoryWithStore(browserHistory, allStore.routing);

const Home = props => props.children;

const Root = () => (
    <Provider {...allStore}>
        <Router history={history}>
            <Route name='root' breadcrumbName='根路由' path='/' component={WeaDebugRouteMenu}>
                {Module.Route}
            </Route>
        </Router>
    </Provider>
);

ReactDOM.render(<Root/>, document.getElementById('container'));
